Creates boxplot and convert it into ggplotly
p <- ggplot(mpg, aes(class, hwy))
p <- p + geom_boxplot()
plotly::ggplotly(p)
p <- ggplot(mpg, aes(hwy, class)) + geom_boxplot()
plotly::ggplotly(p)
p <- ggplot(mpg, aes(class, hwy))
p <- p + geom_boxplot(notch = TRUE)
plotly::ggplotly(p)
p <- ggplot(mpg, aes(class, hwy))
p <- p + geom_boxplot(varwidth = TRUE)
plotly::ggplotly(p)
p <- ggplot(mpg, aes(class, hwy))
p <- p + geom_boxplot(fill = "white", colour = "#3366FF")
plotly::ggplotly(p)
p <- ggplot(mpg, aes(class, hwy))
p <- p + geom_boxplot(outlier.colour = "red", outlier.shape = 1)
plotly::ggplotly(p)
p <- ggplot(mpg, aes(class, hwy))
p <- p + geom_boxplot(outlier.shape = NA) + geom_jitter(width = 0.2)
plotly::ggplotly(p)
p <- ggplot(mpg, aes(class, hwy))
p <- p + geom_boxplot(aes(colour = drv))
plotly::ggplotly(p)
p <-
ggplot(diamonds, aes(carat, price)) +
geom_boxplot()
plotly::ggplotly(p)
## Warning: Continuous x aesthetic -- did you forget aes(group=...)?
p <-
ggplot(diamonds, aes(carat, price)) +
geom_boxplot(aes(group = cut_width(carat, 0.25)))
plotly::ggplotly(p)
p <- ggplot(mpg, aes(class, hwy))
p <-
ggplot(diamonds, aes(carat, price)) +
geom_boxplot(aes(group = cut_width(carat, 0.25)), outlier.alpha = 0.1)
plotly::ggplotly(p)
y <- rnorm(100)
df <- data.frame(
x = 1,
y0 = min(y),
y25 = quantile(y, 0.25),
y50 = median(y),
y75 = quantile(y, 0.75),
y100 = max(y)
)
p <-
ggplot(df, aes(x)) +
geom_boxplot(
aes(ymin = y0, lower = y25, middle = y50, upper = y75, ymax = y100),
stat = "identity"
)
plotly::ggplotly(p)